require 'Switch'
require 'Interface'
require 'Command'
require 'yaml'
require 'libglade2'


prefixSize = Switch.new
prefixSize.id = 0
prefixSize.switch = "-a"
prefixSize.description = "Lenght of Filename Suffixes"
prefixSize.dataFormat = Value.new(DataTypes::INT, 2, 1, 1024)

chunkSize = Switch.new
chunkSize.id = 1
chunkSize.switch = "-b"
chunkSize.description = "Chunk Size"
elements = []
elements << ListElement.new("Bytes", "b")
elements << ListElement.new("Kilobytes", "k")
elements << ListElement.new("Megabytes", "m")
chunkSize.dataFormat = [Value.new(DataTypes::INT, 1, 1, 1024), List.new(DataTypes::STRING, 0, elements)]

cmd = Command.new("split", [prefixSize, chunkSize])


@glade = GladeXML.new("UI.glade", nil, "OpenFracas", nil,  GladeXML::FILE)

def widget(str)
	return @glade.get_widget(str)
end

w = widget("ebOptions")

w.border_width = 6

interface = Interface.new(cmd)


textCmd = Gtk::Entry.new()
textCmd.show


buttonBox = Gtk::HButtonBox.new.show



uiOrganizer = Gtk::VBox.new(false, 6)
uiOrganizer.show
uiOrganizer.pack_start(interface)

uiOrganizer.pack_end(textCmd, false)
uiOrganizer.pack_end(Gtk::HSeparator.new.show, false)

interface.signal_connect("dataModified"){
	textCmd.text = cmd.createCommandString
}
textCmd.text = cmd.createCommandString


sep = Gtk::SeparatorToolItem.new
sep.draw = false
sep.expand = true
sep.visible = true
widget("toolbar").insert(2, sep)


w.add(uiOrganizer)
w.show

widget("mainWindow").show


Gtk.main
